<html>
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="content-type">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
        <title>
            bbs
        </title>
        <style type="text/css">
            .btn {
                width: 100px;
                height: 50px;
                background-color: #ff9900;
                color: #fff;
                font-size: 15px;
                line-height: 50px;
                text-align: center;
                margin: 15px;
            }
        </style>
    </head>
    
    <body>
       <div class="btn" id="savebtn">保存</div>
       <div class="btn" id="getbtn">获取</div>
       <div class="show" id="show"></div>
    </body>
    <script src="../js/bbsbridge.js" type="text/javascript" charset="utf-8"></script>

    <script>
        (function() {
            Bbsbridge.appBbsLifeHook(null);
            var saveObj = document.getElementById('savebtn');
            var getObj = document.getElementById('getbtn');
            var showObj = document.getElementById('show');
            saveObj.addEventListener('click', function() {
                var param = {
                    key: 'aa',
                    "value": 'demo_test'
                };
                param = JSON.stringify(param);
                Bbsbridge.exec("setSharePreference", param, function(data) {
                    console.log("setSharePreference--success");
                    document.getElementById('show').innerHTML = JSON.stringify(data);

                });
            }, false);
            getObj.addEventListener('click', function() {
                var param = {
                    key: 'aa'
                };
                param = JSON.stringify(param);
                Bbsbridge.exec("getSharePreference", param, function(data) {
                    console.log("getSharePreference--success--data--", data);
                    if (data) {
                       document.getElementById('show').innerHTML = JSON.stringify(data);
                    }
                });
            }, false);

        })();
    </script>

</html>